﻿<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>AutomationHomeSite</title>

	<script type="text/javascript" src="Silverlight.js"></script>
	<script type="text/javascript" src="Scene.js"></script>
    <style type="text/css">
		#errorLocation {
			font-size: small;
			color: Gray;
		}
		#silverlightControlHost {
			height: 480px;
      			width: 640px;
		}

	</style>
</head>

<body>
    <!-- Runtime errors from Silverlight will be displayed here.
	This will contain debugging information and should be removed or hidden when debugging is completed -->
	<div id='errorLocation'></div>
	
	<div id="silverlightPlugInHost">
		<script type="text/javascript">
		    if (!window.Silverlight) 
	            window.Silverlight = {};

            Silverlight.createDelegate = function(instance, method) {
	            return function() {
                    return method.apply(instance, arguments);
                }
            }
            
            var scene = new AutomationHomeSite.Scene();
            
            Silverlight.createObjectEx({
	            source: 'Scene.xaml',
	            parentElement: document.getElementById('silverlightPlugInHost'),
	            id: 'silverlightPlugIn',
	            properties: {
		            width: '100%',
		            height: '100%',
		            background:'white',
		            version: '1.0'
	            },
	            events: {
		            onLoad: Silverlight.createDelegate(scene, scene.handleLoad),
		            onError: function(sender, args) {
				        var errorDiv = document.getElementById("errorLocation");
				        if (errorDiv != null) {
					        var errorText = args.errorType + "- " + args.errorMessage;
        							
					        if (args.ErrorType == "ParserError") {
						        errorText += "<br>File: " + args.xamlFile;
						        errorText += ", line " + args.lineNumber;
						        errorText += " character " + args.charPosition;
					        }
					        else if (args.ErrorType == "RuntimeError") {
						        errorText += "<br>line " + args.lineNumber;
						        errorText += " character " +  args.charPosition;
					        }
					        errorDiv.innerHTML = errorText;
				        }	
			        }
	            },		
	            context: null 
            });
		</script>
	</div>
</body>
</html>